package com.cloudkinto.bo.order.outbound;

import com.cloudkinto.enumType.order.outbound.OutboundOriginEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 备货中转出库单新增/草稿修改
 *
 * @author long
 */
@Data
public class NormalOrderOutboundSaveBo {

    private Long id;


    /**
     * 推送到代理仓 0 不需要推送 1 未推送 2 已推送 3 推送失败
     */
    private Integer sendOut;

    /**
     * 推送失败原因
     */
    private String sendOutFailMsg;


    /**
     * 预约开始时间
     */
    @ApiModelProperty("预约开始时间")
    private Date reserveBeginTime;

    /**
     * 预约结束时间
     */
    @ApiModelProperty("预约结束时间")
    private Date reserveEndTime;

    /**
     * 0日常 1预约单 2次日达
     */
    @ApiModelProperty("0日常 1预约单 2次日达")
    private Integer reserveFlag;
    /**
     * 下单时间
     */
    @ApiModelProperty("下单时间")
    private Date orderTime;

    @ApiModelProperty("配送时间")
    private String deliveryDate;

    @ApiModelProperty("配送时间带")
    private String deliveryTimeName;

    /**
     * 状态
     */
    @ApiModelProperty("status状态")
    private Integer status;

    /**
     * 仓库id
     */
    @ApiModelProperty(value = "仓库id", required = true)
    @NotNull(message = "仓库id不能为空")
    private Long whId;

    /**
     * 物流渠道id
     */
    @ApiModelProperty(value = "物流渠道id", required = true)
    @NotNull(message = "物流渠道id不能为空")
    private Long logisticsChannelId;

    @ApiModelProperty(value = "店铺id")
    private Long storeId;

    /**
     * 承运商代码
     */
    @ApiModelProperty(value = "承运商")
    private String carrier;

    @ApiModelProperty(value = "面单id")
    private Long labelFileId;

    /**
     * 物流跟踪号
     */
    @ApiModelProperty(value = "物流跟踪号")
    private String trackingNumber;

    /**
     * 销售平台
     */
    @ApiModelProperty(value = "销售平台")
    private Integer salesPlatform;

    /**
     * 平台单号
     */
    @ApiModelProperty(value = "平台单号")
    private String platformOrderNo;

    /**
     * 参考单号
     */
    @ApiModelProperty(value = "参考单号")
    private String referenceNumber;

    /**
     * 签名服务
     */
    @ApiModelProperty(value = "签名服务")
    private String signatureService;

    /**
     * 是否要求保险
     */
    @ApiModelProperty(value = "是否要求保险")
    private Boolean insuranceFlag;

    /**
     * 保险金额
     */
    @ApiModelProperty(value = "保险金额")
    private BigDecimal insureMoney;

    private String remark;
    private String remark2;

    /**
     * 订单来源 {@link OutboundOriginEnum}
     */
    @ApiModelProperty(value = "订单来源")
    private Integer orderOrigin;

    /**
     * 总数
     */
    @ApiModelProperty(value = "总数", required = true)
    @NotNull(message = "总数不能为空")
    private Integer totalNum;

    /**
     * 收件人
     */
    @ApiModelProperty(value = "收件人", required = true)
    @NotEmpty(message = "收件人不可为空")
    private String receiver;

    /**
     * 电话
     */
    @ApiModelProperty(value = "电话")
    private String phone;

    /**
     * 邮箱
     */
    @ApiModelProperty(value = "邮箱")
    private String email;

    /**
     * 收件人税号
     */
    @ApiModelProperty(value = "收件人税号")
    private String taxNum;

    /**
     * 公司名称
     */
    @ApiModelProperty(value = "公司名称")
    private String companyName;

    private String companyTag;

    /**
     * 国家地区二字码
     */
    @ApiModelProperty(value = "国家地区二字码", required = true)
    @NotEmpty(message = "国家地区二字码不可为空")
    private String countryRegionCode;

    /**
     * 省/州
     */
    @ApiModelProperty(value = "省/州")
    private String provinceName;

    /**
     * 城市名称
     */
    @ApiModelProperty(value = "城市名称", required = true)
//    @NotEmpty(message = "城市名称不可为空")
    private String cityName;

    /**
     * 邮编
     */
    @ApiModelProperty(value = "邮编", required = true)
    @NotEmpty(message = "邮编不可为空")
    private String postCode;

    /**
     * 门牌号
     */
    @ApiModelProperty(value = "门牌号")
    private String houseNum;

    /**
     * 地址1
     */
    @ApiModelProperty(value = "地址1", required = true)
    @NotEmpty(message = "地址1不可为空")
    private String address1;

    /**
     * 地址2
     */
    @ApiModelProperty(value = "地址2")
    private String address2;

    /**
     * 附件
     */
    @ApiModelProperty(value = "附件ids,逗号分隔")
    private String appendixIds;

    @ApiModelProperty(value = "自定义渠道名")
    private String customizeChannelName;

    /**
     * 产品信息
     */
    @ApiModelProperty(value = "产品信息", required = true)
    @NotNull(message = "产品信息不能为空")
    private List<NormalOrderOutboundSaveBo.NormalOrderOutboundProductSaveBo> productInfoList;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class NormalOrderOutboundProductSaveBo {
        @ApiModelProperty(value = "产品id", required = true)
        private Long productId;
        @ApiModelProperty(value = "sku", required = true)
        private String sku;
        @ApiModelProperty(value = "预报出库数量", required = true)
        private Integer forecastQty;
        @ApiModelProperty(value = "申报价格")
        private BigDecimal declarePrice;
        @ApiModelProperty(value = "申报价格 货币代码")
        private String currencyCode;

        public NormalOrderOutboundProductSaveBo(Long productId, String sku, BigDecimal declarePrice, String currencyCode) {
            this.productId = productId;
            this.sku = sku;
            this.declarePrice = declarePrice;
            this.currencyCode = currencyCode;
        }
    }
}
